//#include<iostream>
//#include<vector>
//using namespace std;
//vector<int>v;
//vector<int>numb;
//vector<int>count;
//int main()
//{
// while(1) { 
   //cout<<"v["<<v.size()<<"]= ";
  // int i;
  // cin>>i;
   //if(0==i)break;
 //  v.push_back(i);}
   
//return 0; 
//}
#include<iostream>
#include<vector>
using namespace std;
int main() {

vector<int>v(1);
vector<int>numb(1);
vector<int>count(1);
int j=0;
v[0]=1;
while (v[j]!=0) { 
 j+=1;
v.size(j+1);
cin>>v[j];
}
int x;
int kmax=1;
for(int i=1; i<=j; i++)
{
x=0;
for (int k=1; k<=kmax; k++)
{
if (v[i]==numb[k]) {count[k]++; x=1; break;}
}
if (0==x) {numb.size(kmax+1); count.size(kmax+1);numb[kmax]=v[i]; count[kmax]=1;kmax++;}
}
for (int r=1; r<=kmax-2; r++) cout<<numb[r]<<" "<<count[r]<<endl;
return 0;

